Some Engineer logics on Warheads - #1801
Conversation
- Now `infantry` and `units` can execute some operations engineers do without loosing the firer like happens with engineers. - `FakeEngineer.CanRepairBridges`, if set to true, when a building with `BridgeRepairHut=yes` linked to a bridge is affected by the Warhead then all destroyed bridge sections will be fixed. - `FakeEngineer.CanDestroyBridges`, if set to true, when a building with `BridgeRepairHut=yes` linked to a bridge is affected by the Warhead then all the bridge will be destroyed. - `FakeEngineer.CanCaptureBuildings`, if set to true, a building with `Capturable=true` or `NeedsEngineer=true` is affected by the Warhead then the building will be captured by the house's firer. In `rulesmd.ini`: ```ini [SOMEWARHEAD] ; WarheadType FakeEngineer.CanRepairBridges=false ; boolean FakeEngineer.CanDestroyBridges=false ; boolean FakeEngineer.CanCaptureBuildings=false ; boolean ```
Removed all repetitive code related to checks and placed all that in a new method called CanBeAffectedByFakeEngineer(...)
Found a silent crash. Code tweaks
- Added ForceWeapon.Capture. - Added FakeEngineer.BombDisarm. - Code cleanup and improvements.
|
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
|
warhead has its own |
|
FakeEngineer.DisarmBombs & FakeEngineer.CanDestroyBridges dont work |
and code improvements like adding the "send event" in the capture building, because I think the radar event the capture function has doesn't trigger the Enter event in map triggers. Also, now can be triggered both repair bridge & destroy bridge depending of the current bridge status if both tags are enabled in the warhead.
Vanilla tag "BombDisarm" makes the wapon unusable for other purposes that isn't defuse bombs, also disrupts the weapons selection if you try to use the multiweapons and that tag isn't in the last weapon of the multiweapon list. Try yourself if you aren't sure of my findings (I could be wrong) :-) |
You are right about the FakeEngineer.CanDestroyBridges, I broke it days before I started this PR, I'm sorry. Now is fixed. You can have both repair & destroy tags in the same warhead and the bridge will be repaired or destroyed depending the current status of the bridge. As I mentioned to NetsuNegi I used this new disarm bombs tag in a repair weapon inside a multiweapon in a combat engineer with this weapons order: |
|
when FakeEngineer.CanDestroyBridges=1 & FakeEngineer.CanRepairBridges=1 in a same warhead, bridge cant be repaired or destroyed |
|
after update, FakeEngineer.CanRepairBridges can repair bridges which are NOT broken. FakeEngineer.DisarmBombs still doesnt work. |
TaranDahl
left a comment
There was a problem hiding this comment.
Too many problems. I think the author lacks the necessary understanding of the unit's firing procedure.
| // Send engineer's "enter" event | ||
| auto const pTag = pBuilding->AttachedTag; | ||
| if (args->Attacker && pTag) | ||
| pTag->RaiseEvent(TriggerEvent::EnteredBy, args->Attacker, CellStruct::Empty); |
There was a problem hiding this comment.
I think this is unreasonable because nothing has entered the target.
There was a problem hiding this comment.
Should raise DestroyedByAnything
There was a problem hiding this comment.
Regarding raising TriggerEvent::EnteredBy instead of DestroyedByAnything (or omitting it):
If I'm not wrong in RA2 and YR map scripting (both original campaign missions and custom community maps), mappers use the trigger event Entered By... (Trigger Event 1) on neutral Tech Buildings, mission-critical structures, and Bridge Repair Huts to detect when an engineer captures the building or repairs the bridge.
Since entering the structure was vanilla's only way for an engineer to capture buildings or trigger bridge repairs, EnteredBy serves as the de-facto event hook for map scripts to advance mission objectives (e.g., "Capture Tech Hospital -> Entered by Player -> Objective Completed / Reveal Area").
If we do not raise EnteredBy: Any map trigger expecting the structure to be captured by an engineer will never trigger, breaking campaign progression and custom map scripts.
If we were to raise DestroyedByAnything on capture: It would break missions that have fail conditions like "Protect this structure (Fail if DestroyedByAnybody)", causing an immediate Mission Failed upon capturing the building instead of securing it.
Therefore, raising TriggerEvent::EnteredBy is intentional and necessary to maintain full compatibility with existing map scripts and trigger systems when capturing structures or repairing bridge huts remotely via warheads.
There was a problem hiding this comment.
If we do not raise EnteredBy: Any map trigger expecting the structure to be captured by an engineer will never trigger, breaking campaign progression and custom map scripts.
Why would an unmerged feature break anything? It doesn't modify any vanilla behavior.
There was a problem hiding this comment.
Because is supposed to be used by support units like engineers/saboteurs and those doesn'tdestroy, they capture. I can't imagine these tags in standard units.
|
I applied feedback and small changes. |





Engineer logics on Warheads
InfantryType,VehicleType,BuildingTypeorAircraftTypecan execute some operations engineers do without loosing the firer in the process.FakeEngineer.CanRepairBridges, if set to true, when a building withBridgeRepairHut=yeslinked to a bridge is affected by the Warhead then all destroyed bridge sections will be fixed.FakeEngineer.CanDestroyBridges, if set to true, when a building withBridgeRepairHut=yeslinked to a bridge is affected by the Warhead then all the bridge will be destroyed.FakeEngineer.CanCaptureBuildings, if set to true, a building withCapturable=trueorNeedsEngineer=trueis affected by the Warhead then the building will be captured by the house's firer.FakeEngineer.DisarmBombs, if set to true, an attached bomb will be removed if the target is affected by the Warhead.In
rulesmd.ini:Regarding "Forcing specific weapon against certain targets":
ForceWeapon.Captureforces specified weapon to be used if the target building is capturable.In
rulesmd.ini: